/*! \file $Id: MotionSettingUI.java 35266 2014-08-07 07:17:57Z litl $
 * \author 作者
 * \brief 手势说明提示
 */
package com.bnq.control.desktop.popup;

import static com.oray.sunlogin.plugin.remotedesktop.CompressionModeConfig.MODE_HD;
import static com.oray.sunlogin.plugin.remotedesktop.CompressionModeConfig.MODE_SMOOTH;
import static com.oray.sunlogin.plugin.remotedesktop.CompressionModeConfig.MODE_SPEED;

import android.content.Context;
import android.content.res.Resources;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.TextView;

import com.bnq.control.R;


public class DesktopModePopup extends XmlPopup {

    TextView hdMode, smoothMode, speedMode;

    public DesktopModePopup(Context context) {
        super(context, R.layout.change_model_view);
    }

    public void setCurrentMode(int currentMode) {
        Resources resources = getContext().getResources();

        hdMode.setTextColor(MODE_HD == currentMode ? resources.getColor(R.color.red) : resources.getColor(R.color.white));
        smoothMode.setTextColor(MODE_SMOOTH == currentMode ? resources.getColor(R.color.red) : resources.getColor(R.color.white));
        speedMode.setTextColor(MODE_SPEED == currentMode ? resources.getColor(R.color.red) : resources.getColor(R.color.white));
    }

    @Override
    protected void onInitView(View rootView, OnClickListener l) {
        super.onInitView(rootView, l);
        ViewGroup container = (ViewGroup) rootView
                .findViewById(R.id.new_style_mode);

        hdMode = rootView.findViewById(R.id.hd_mode);
        smoothMode = rootView.findViewById(R.id.smooth_mode);
        speedMode = rootView.findViewById(R.id.speed_mode);

        // 设置所有项的单击事件
        int childCount = container.getChildCount();
        View child;
        for (int i = 0; i < childCount - 1; i++) {
            child = container.getChildAt(i);
            child.setOnClickListener(l);
        }

        child = container.findViewById(R.id.btn_cancel);
        child.setOnClickListener(l);
    }

}
